home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Tcl_SetVar C Library Procedures Tcl_SetVar
-
-
-
- _________________________________________________________________
-
- NNAAMMEE |
- Tcl_SetVar, Tcl_SetVar2, Tcl_GetVar, Tcl_GetVar2, |
- Tcl_UnsetVar, Tcl_UnsetVar2 - manipulate Tcl variables |
-
- SSYYNNOOPPSSIISS |
- ##iinncclluuddee <<ttccll..hh>> |
-
- char * |
- TTccll__SSeettVVaarr(_i_n_t_e_r_p, _v_a_r_N_a_m_e, _n_e_w_V_a_l_u_e, _f_l_a_g_s) |
-
- char * |
- TTccll__SSeettVVaarr22(_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _n_e_w_V_a_l_u_e, _f_l_a_g_s) |
-
- char * |
- TTccll__GGeettVVaarr(_i_n_t_e_r_p, _v_a_r_N_a_m_e, _f_l_a_g_s) |
-
- char * |
- TTccll__GGeettVVaarr22(_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _f_l_a_g_s) |
-
- int |
- TTccll__UUnnsseettVVaarr(_i_n_t_e_r_p, _v_a_r_N_a_m_e, _f_l_a_g_s) |
-
- int |
- TTccll__UUnnsseettVVaarr22(_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _f_l_a_g_s) |
-
- AARRGGUUMMEENNTTSS |
- Tcl_Interp *_i_n_t_e_r_p (in) ||
- Interpreter containing |
- variable. |
-
- char *_v_a_r_N_a_m_e (in) ||
- Name of variable. May |
- refer to a scalar vari- |
- able or an element of an |
- array variable. |
-
- char *_n_e_w_V_a_l_u_e (in) ||
- New value for variable. |
-
- int _f_l_a_g_s (in) ||
- OR-ed combination of bits |
- providing additional |
- information for opera- |
- tion. See below for valid |
- values. |
-
- char *_n_a_m_e_1 (in) ||
- Name of scalar variable, |
- or name of array variable |
- if _n_a_m_e_2 is non-NULL. |
-
-
-
- Sprite v1.0 1
-
-
-
-
-
-
- Tcl_SetVar C Library Procedures Tcl_SetVar
-
-
-
- char *_n_a_m_e_2 (in) ||
- If non-NULL, gives name |
- of element within array |
- and _n_a_m_e_1 must refer to |
- an array variable. |
- _________________________________________________________________ |
-
-
- DDEESSCCRRIIPPTTIIOONN |
- These procedures may be used to create, modify, read, and |
- delete Tcl variables from C code. TTccll__SSeettVVaarr and |
- TTccll__SSeettVVaarr22 will create a new variable or modify an existing |
- one. Both of these procedures set the given variable to the |
- value given by _n_e_w_V_a_l_u_e, and they return a pointer to a copy |
- of the variable's new value, which is stored in Tcl's vari- |
- able structure. Tcl keeps a private copy of the variable's |
- value, so the caller may change _n_e_w_V_a_l_u_e after these pro- |
- cedures return without affecting the value of the variable. |
- If an error occurs in setting the variable (e.g. an array |
- variable is referenced without giving an index into the |
- array), then NULL is returned. |
-
- The name of the variable may be specified in either of two |
- ways. If TTccll__SSeettVVaarr is called, the variable name is given |
- as a single string, _v_a_r_N_a_m_e. If _v_a_r_N_a_m_e contains an open |
- parenthesis and ends with a close parenthesis, then the |
- value between the parentheses is treated as an index (which |
- can have any string value) and the characters before the |
- first open parenthesis are treated as the name of an array |
- variable. If _v_a_r_N_a_m_e doesn't have parentheses as described |
- above, then the entire string is treated as the name of a |
- scalar variable. If TTccll__SSeettVVaarr22 is called, then the array |
- name and index have been separated by the caller into two |
- separate strings, _n_a_m_e_1 and _n_a_m_e_2 respectively; if _n_a_m_e_2 is |
- zero it means that a scalar variable is being referenced. |
-
- The _f_l_a_g_s argument may be used to specify any of several |
- options to the procedures. It consists of an OR-ed combina- |
- tion of any of the following bits: |
-
- TCL_GLOBAL_ONLY ||
- Under normal circumstances the procedures look up vari- |
- ables at the current level of procedure call for |
- _i_n_t_e_r_p, or at global level if there is no call active. |
- However, if this bit is set in _f_l_a_g_s then the variable |
- is looked up at global level even if there is a pro- |
- cedure call active. |
-
- TCL_LEAVE_ERR_MSG ||
- If an error is returned and this bit is set in _f_l_a_g_s, |
- then an error message will be left in _i_n_t_e_r_p->_r_e_s_u_l_t. |
- If this flag bit isn't set then no error message is |
-
-
-
- Sprite v1.0 2
-
-
-
-
-
-
- Tcl_SetVar C Library Procedures Tcl_SetVar
-
-
-
- left (_i_n_t_e_r_p->_r_e_s_u_l_t will not be modified). |
-
- TCL_APPEND_VALUE ||
- If this bit is set then _n_e_w_V_a_l_u_e is appended to the |
- current value, instead of replacing it. If the vari- |
- able is currently undefined, then this bit is ignored. |
-
- TCL_LIST_ELEMENT ||
- If this bit is set, then _n_e_w_V_a_l_u_e is converted to a |
- valid Tcl list element before setting (or appending to) |
- the variable. If the list element is being appended to |
- an non-empty value, then a space character is appended |
- before the new list element to separate it from previ- |
- ous elements. |
-
- TCL_NO_SPACE ||
- If this bit is set, it prevents the output of a |
- separating space character in TCL_LIST_ELEMENT appends. |
- This bit has no effect if the TCL_LIST_ELEMENT bit |
- isn't set. |
-
- TTccll__GGeettVVaarr and TTccll__GGeettVVaarr22 return the current value of a |
- variable. The arguments to these procedures are treated in |
- the same way as the arguments to TTccll__SSeettVVaarr and TTccll__SSeettVVaarr22. |
- Under normal circumstances, the return value is a pointer to |
- the variable's value (which is stored in Tcl's variable |
- structure and will not change before the next call to |
- TTccll__SSeettVVaarr or TTccll__SSeettVVaarr22). The only bits of _f_l_a_g_s that are |
- used are TCL_GLOBAL_ONLY and TCL_LEAVE_ERR_MSG, both of |
- which have the same meaning as for TTccll__SSeettVVaarr. If an error |
- occurs in reading the variable (e.g. the variable doesn't |
- exist or an array element is specified for a scalar vari- |
- able), then NULL is returned. |
-
- TTccll__UUnnsseettVVaarr and TTccll__UUnnsseettVVaarr22 may be used to remove a vari- |
- able, so that future calls to TTccll__GGeettVVaarr or TTccll__GGeettVVaarr22 for |
- the variable will return an error. The arguments to these |
- procedures are treated in the same way as the arguments to |
- TTccll__GGeettVVaarr and TTccll__GGeettVVaarr22. If the variable is successfully |
- removed then 0 is returned. If the variable cannot be |
- removed because it doesn't exist or because a trace is |
- active for it, then -1 is returned. If an array element is |
- specified, the given element is removed but the array |
- remains. If an array name is specified without an index, |
- then the entire array is removed. |
-
-
- SSEEEE AALLSSOO |
- Tcl_TraceVar |
-
-
-
-
-
-
- Sprite v1.0 3
-
-
-
-
-
-
- Tcl_SetVar C Library Procedures Tcl_SetVar
-
-
-
- KKEEYYWWOORRDDSS |
- array, interpreter, scalar, set, unset, variable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sprite v1.0 4
-
-
-
-